package run.siyuan.model;

import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data;

import java.math.BigDecimal;

/**
 * member_amount
 *
 * @author
 */
@Data
@TableName("member_amount")
public class MemberAmount extends BaseEntity {

    /**
     * 用户id
     */
    // @ApiModelProperty("用户id")
    private Long memberId;

    /**
     * 邀请码
     */
    // @ApiModelProperty("邀请码")
    private String inviteCode = "";

    /**
     * 用户余额
     */
    // @ApiModelProperty("用户余额")
    private BigDecimal amount = BigDecimal.ZERO;

    /**
     * 已确认收益金额
     */
    // @ApiModelProperty("已确认收益金额")
    private BigDecimal creditedAmount = BigDecimal.ZERO;

    /**
     * 封装对象
     *
     * @param member
     * @return
     */
    public static MemberAmount buildMemberAmount(Member member) {
        MemberAmount amount = new MemberAmount();
        amount.setMemberId(member.getId());
        amount.setInviteCode(member.getInviteCode());
        amount.setAmount(BigDecimal.ZERO);
        amount.setCreditedAmount(BigDecimal.ZERO);
        return amount;
    }


}